import {getTodoList} from "@/services/todo";

export default {
    namespace: "todo",

    state: {
        todoList: [],
    },

    effects: {
        * fetchTodoList(_, {call, put}) {
            const data = yield call(getTodoList)
            yield  put({
                type: "setTodoList",
                payload: data,
            })
        }
    },

    reducers: {
        setTodoList(state, action) {
            return {
                ...state,
                todoList: action.payload,
            }
        }
    }

}



